package com.tang.algorithm.ordinary;

/**
 * @author tlm
 * @version 1.0
 * @date 2020/7/1 20:57
 */
public class LeetCode1266 {
    public int minTimeToVisitAllPoints(int[][] points) {
        int sum = 0;
        for (int i = 1; i < points.length; i++) {
            int[] point = points[i];
            int[] pointAhead = points[i - 1];
            int absX = Math.abs(point[0] - pointAhead[0]);
            int absY = Math.abs(point[1] - pointAhead[1]);
            sum += Math.max(absX, absY);
        }

        return sum;
    }
}
